Skip to content

feat(ledger): add config profiles and configurable retry ceiling - #140

Merged
tiana-code merged 1 commit into
mainfrom
feat/E-01-config-profiles-retry
Jun 16, 2026
Merged

feat(ledger): add config profiles and configurable retry ceiling#140
tiana-code merged 1 commit into
mainfrom
feat/E-01-config-profiles-retry

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

What

Introduces dev/test/prod Spring profiles and makes the optimistic-lock retry ceiling configurable.

Why

The service ran on a single bare application.yml with no environment separation and no home for tunables. The retry ceiling was a hardcoded const val MAX_ATTEMPTS = 3; #58 requires it to change via configuration.

How

  • Baseline application.yml plus application-dev.yml (local services), application-test.yml (Testcontainers-compatible, no hardcoded datasource so @DynamicPropertySource stays authoritative), application-prod.yml (${ENV} placeholders only, ddl-auto: validate).
  • Typed IdempotencyProperties (@Validated, @Min(1), default 3) bound under fincore.ledger.idempotency.max-attempts, injected into IdempotencyServiceImpl, registered via @EnableConfigurationProperties on LedgerApplication and on the three @DataJpaTest ITs that import the service.
  • IdempotencyPropertiesTest (ApplicationContextRunner) proves default binds to 3, overrides bind, and a value below 1 is rejected. IdempotencyServiceImplTest gains an AC-5 case proving a configured ceiling drives the attempt count.

The retry boundary is unchanged (retry stays outside the transaction); only the count is injected.

Scope note

#62 AC-5 (service starts with the dev profile under Docker Compose) is verified by #66, which delivers the compose file and image (neither exists yet).

Closes #58
Closes #62

Restructure application.yml into a baseline plus dev, test, and prod overlays.
The dev profile targets local services, test stays Testcontainers-compatible
(no hardcoded datasource), and prod references every sensitive value through an
environment-variable placeholder with no secret literals.

Bind the optimistic-lock retry ceiling to fincore.ledger.idempotency.max-attempts
(default 3, validated >= 1) via a typed IdempotencyProperties, replacing the
hardcoded constant so the count changes through configuration, not code.

#62 AC-5 (live docker-compose boot) is verified by #66, which delivers the
compose file and image.

Closes #58
Closes #62
@tiana-code
tiana-code merged commit 9319c0c into main Jun 16, 2026
6 checks passed
@tiana-code
tiana-code deleted the feat/E-01-config-profiles-retry branch June 16, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add application.yml and dev/test/prod profiles Optimistic-lock retry test

1 participant